import axios from "./axios.min.js";

const request = axios.create({
    baseURL: "http://10.19.0.31:3000",
    // baseURL: "http://localhost:3000",
});

request.interceptors.request.use(
    function (config) {
        const token = localStorage.getItem("token");
        if (token) {
            config.headers["token"] = token;
        }
        return config;
    },
    function (error) {
        return Promise.reject(error);
    }
);

request.interceptors.response.use(
    function (response) {
        return response.data;
    },
    function (error) {
        return Promise.reject(error);
    }
);

export default request;
